package xian.woniuxy.be.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import xian.woniuxy.be.dao.ContactpersonMapper;
import xian.woniuxy.be.dao.custom.CustomContactpersonMapper;
import xian.woniuxy.be.entity.Contactperson;
import xian.woniuxy.be.entity.Customer;
import xian.woniuxy.be.service.IContactpersonService;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Gong
 * @time 2022/01/09 00:28:36
 */
@Service
@Transactional
public class ContactpersonServiceImpl implements IContactpersonService {

    @Autowired
    private CustomContactpersonMapper contactpersonMapper;

    @Override
    public void save(Contactperson contactperson) {
        contactpersonMapper.insert(contactperson);
    }

    @Override
    public void delete(int conId) {
        contactpersonMapper.deleteByPrimaryKey(conId);
    }

    @Override
    public void update(Contactperson contactperson) {
        contactpersonMapper.updateByPrimaryKey(contactperson);
    }

    @Override
    public List<Contactperson> findAll() {
        List<Contactperson> list = contactpersonMapper.selectByExample(null);
        return list;
    }

    @Override
    public List<Contactperson> findOne(int cusId) {
        List<Contactperson> list = contactpersonMapper.selectOne(cusId);

        return list;
    }

    @Override
    public List<Contactperson> selectFromname(String theName) {
        List<Contactperson> list = contactpersonMapper.selectFromname(theName);
        return list;
    }
}
